package com.edu.hbwe.book.dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import com.edu.hbwe.book.dao.NoticeDao;
import com.edu.hbwe.book.entity.Notice;
import com.edu.hbwe.book.util.DbUtil;

public class NoticeDaoImpl implements NoticeDao {

	public Notice getRecentNotice() throws SQLException {
		String sql = "select * from notice order by n_time desc limit 0,1";
		QueryRunner runner = new QueryRunner(DbUtil.getDataSource());
		return runner.query(sql, new BeanHandler<Notice>(Notice.class));
	}

}
